import type { RouteRecordRaw } from 'vue-router'
import { t } from '@/hooks/useI18n'

const moduleName = 'system'

const routes: Array<RouteRecordRaw> = [
  {
    path: '/system',
    name: moduleName,
    redirect: '/system/user/list',
    meta: {
      title: t('routes.system._system'),
      icon: 'ant-design:setting-outlined',
    },
    children: [
      {
        path: 'user',
        name: `${moduleName}-user`,
        redirect: '/system/user/list',
        meta: {
          title: t('routes.system.system._user'),
          icon: 'ant-design:user-outlined',
        },
        children: [
          {
            path: 'list',
            name: `${moduleName}-user-list`,
            meta: {
              title: t('routes.system.system.user.list'),
            },
            component: () => import('@/views/system/user/index.vue'),
          },
        ],
      },
      {
        path: 'role',
        name: `${moduleName}-role`,
        redirect: '/system/role/list',
        meta: {
          title: t('routes.system.system._role'),
          icon: 'ant-design:solution-outlined',
        },
        children: [
          {
            path: 'list',
            name: `${moduleName}-role-list`,
            meta: {
              title: t('routes.system.system.role.list'),
            },
            component: () => import(/* viteChunk: "role" */ '@/views/system/role/index.vue'),
          },
          {
            path: 'detail/:id',
            name: `${moduleName}-role-detail`,
            meta: {
              title: t('routes.system.system.role.detail'),
              activeMenu: '/system/role',
              hideInMenu: true,
            },
            component: () => import(/* viteChunk: "role" */ '@/views/system/role/detail.vue'),
          },
        ],
      },
      {
        path: 'service',
        name: `${moduleName}-service`,
        redirect: '/system/service/list',
        meta: {
          title: t('routes.system.system._service'),
          icon: 'ant-design:deployment-unit-outlined',
        },
        children: [
          {
            path: 'list',
            name: `${moduleName}-service-list`,
            meta: {
              title: t('routes.system.system.service.list'),
            },
            component: () => import('@/views/system/service/list/index.vue'),
          },
          {
            path: 'apis',
            name: `${moduleName}-service-apis`,
            meta: {
              title: t('routes.system.system.service.apis'),
            },
            component: () => import('@/views/system/service/apis/index.vue'),
          },
        ],
      },
      {
        path: 'config',
        name: `${moduleName}-config`,
        redirect: '/system/config/list',
        meta: {
          title: t('routes.system.system._config'),
          icon: 'ant-design:tool-outlined',
        },
        children: [
          {
            path: 'func',
            name: `${moduleName}-config-func`,
            meta: {
              title: t('routes.system.system.config.func'),
            },
            component: () => import('@/views/system/config/func/index.vue'),
          },
          {
            path: 'file',
            name: `${moduleName}-config-file`,
            meta: {
              title: t('routes.system.system.config.file'),
            },
            component: () => import('@/views/system/config/file/index.vue'),
          },
          {
            path: 'message',
            name: `${moduleName}-config-message`,
            meta: {
              title: t('routes.system.system.config.message'),
            },
            component: () => import('@/views/system/config/message/index.vue'),
          },
          {
            path: 'voice',
            name: `${moduleName}-config-voice`,
            meta: {
              title: t('routes.system.system.config.voice'),
            },
            component: () => import('@/views/system/config/voice/index.vue'),
          },
          {
            path: 'tts',
            name: `${moduleName}-config-tts`,
            meta: {
              title: t('routes.system.system.config.tts'),
            },
            component: () => import('@/views/system/config/tts/index.vue'),
          },
          {
            path: 'wxApplet',
            name: `${moduleName}-config-wxApplet`,
            meta: {
              title: t('routes.system.system.config.wxApplet'),
            },
            component: () => import('@/views/system/config/wxApplet/index.vue'),
          },
          {
            path: 'appid',
            name: `${moduleName}-config-appid`,
            meta: {
              title: t('routes.system.system.config.appid'),
            },
            component: () => import('@/views/system/config/appid/index.vue'),
          },
        ],
      },
      {
        path: 'operation',
        name: `${moduleName}-operation`,
        redirect: '/system/operation/list',
        meta: {
          title: t('routes.system.system._operation'),
          icon: 'ant-design:snippets-outlined',
        },
        children: [
          {
            path: 'list',
            name: `${moduleName}-operation-list`,
            meta: {
              title: t('routes.system.system.operation.list'),
            },
            component: () => import('@/views/system/operation/index.vue'),
          },
        ],
      },
    ],
  },
]
export default routes
